package sctu.edu.java.year2016.team04.yanghuilin.day20160522.chapter5_3;

/**
 * Created by dell on 2016/5/22.
 * 创建二维数组arr[]，将二维数组中所有元素的和输出。
 */
public class FiveThree {
    public static void main(String[] args) {
        int arr[][]=new int[][]{{1,2,3},{4,5,6},{7,8,9}};
        int sum=0;
        System.out.println("二维数组是：");
        for(int i=0;i<arr.length;i++){
            for(int t=0;t<arr[i].length;t++){
                System.out.print(arr[i][t] + " ");
                sum=sum+arr[i][t];
            }
            System.out.println("\n");

        }
        System.out.println("数组的和为"+sum);

    }
}
